import { Component, OnInit } from '@angular/core';
import {CudTableService} from '../../../public/serve/cud-table/cud-table.service';
import {Service} from '../../../server/server';
import {HintsService} from '../../../public/serve/hints/hints.service';

@Component({
  selector: 'app-home-page-top',
  templateUrl: './home-page-top.component.html',
  styleUrls: ['./home-page-top.component.css']
})
export class HomePageTopComponent implements OnInit {

  constructor(public request: CudTableService,public server: Service, private hintsService: HintsService,) { }
  public publishCountInfo = {};
  ngOnInit() {
    this.getPublishCount();
  }

    /**
     * 查询首页统计总数
     */
    getPublishCount() {
        this.request.postRequest(this.server.baseUrl + "admin/index/getPublishCount", {}).then((res: any) => {
            if (res.result_code === '0000') {
                this.publishCountInfo = res.result;
            } else {
                this.hintsService.messages(res.message,res.result_code);
            }
            return;
        })
            .catch((err: any) => {
                this.hintsService.messages("error","error");
                return;
            });
    }

}
